<%@ Language=VBScript %>
<%Option Explicit%>
<%Server.ScriptTimeout = 3600%>

<!--#include file="../cons.asp"-->
<!--#include file="../../Common/Database.asp"-->
<!--#include file="PrintResumenCurricular.asp"-->

<%
	Dim oRSAlumnos
	Dim a
	session.Abandon
	response.CacheControl = "no-cache"
	
	Application("CountAlumnos") = GetCountAlumnos()
	
	DropListadosProcesados()
	
	Set oRSAlumnos = GetListadodeAlumnos()
	
	while not oRSAlumnos.EOF
		
		id_Alumno = oRSAlumnos("IdAlumno")
		idSedeCurso = oRSAlumnos("IdSedeCurso")
		
		Call RenderPrintResumenCurricular
		
		'for a = 1 to cInt(Application("CountAlumnos"))
		'	if not oRSAlumnos.EOF then
		'		Application("iCount") = Application("iCount") + 1
		'		oRSAlumnos.MoveNext()
		'	end if
			
		'next
		Application("iCount") = Application("iCount") + 1
		oRSAlumnos.MoveNext()
	wend
	
	'for a=1 to 1
	'	Call RenderPrintResumenCurricular
	'	Application("iCount") = Application("iCount") + 1
	'next
	
	Public function GetListadodeAlumnos()

		Dim oConn, sSQL, oRS
		
		Set oConn = OpenConnection
		
		sSQL =	"select distinct A.IdAlumno, MC.IdSedeCurso from Alumno A " & _
				"inner join AlumnoCurso AC on (AC.IdAlumno = A.IdAlumno) " & _
				"inner join MateriaCurso MC on (MC.IdMateriaCurso = AC.IdMateriaCurso) " & _
				"order by MC.IdSedeCurso, A.Apellido, A.Nombre"
		
		Set oRS = oConn.Execute(sSQL)
		Set GetListadodeAlumnos = oRS
	End function
	
	Public function GetCountAlumnos()

		Dim oConn, sSQL, oRS
		
		Set oConn = OpenConnection
		
		sSQL =	"select count(*) from Alumno"
		
		Set oRS = oConn.Execute(sSQL)
		
		GetCountAlumnos = oRS(0)
	End function
		
	Public function DropListadosProcesados()

		Dim oConn, sSQL, oRS
		
		Set oConn = OpenConnection
		
		sSQL =	"delete from ListadosProcesados"
		
		Set oRS = oConn.Execute(sSQL)
	End function
%>